package zx.tas.model

import kotlinx.coroutines.script.C

data class GABPanelPlanV2(
    val atk: SkillV2,
    val skillA: SkillV2,
    val skillB: SkillV2,
    val skillC: SkillV2,
    val skillD: SkillV2,
    val skillE: SkillV2,
    val skillF800: SkillV2,
    val skillF800b: SkillV2,
) {
    fun requireItem(selectedKey: String?): SkillV2 {
        return if (C.V_ATK == selectedKey) atk
        else if (C.V_SKILL_A == selectedKey) skillA
        else if (C.V_SKILL_B == selectedKey) skillB
        else if (C.V_SKILL_C == selectedKey) skillC
        else if (C.V_SKILL_D == selectedKey) skillD
        else throw IllegalArgumentException("updateItem selectedKey $selectedKey")
    }

    fun updateItem(selectedKey: String, item: SkillV2): GABPanelPlanV2 {
        return if (C.V_ATK == selectedKey) this.copy(atk = item)
        else if (C.V_SKILL_A == selectedKey) this.copy(skillA = item)
        else if (C.V_SKILL_B == selectedKey) this.copy(skillB = item)
        else if (C.V_SKILL_C == selectedKey) this.copy(skillC = item)
        else if (C.V_SKILL_D == selectedKey) this.copy(skillD = item)
        else throw IllegalArgumentException("updateItem selectedKey $selectedKey")
    }

    companion object {
        val default: GABPanelPlanV2
            get() {
            return GABPanelPlanV2(
                atk = SkillV2(C.V_ATK, 1, 0, 0, 0), // 点击还是75ms正常. 之前这里长期150
                skillA = SkillV2(C.V_SKILL_A, 1, 26100, 0, 1),
                skillB = SkillV2(C.V_SKILL_B, 1, 26100, 0, 1),
                skillC = SkillV2(C.V_SKILL_C, 1, 26100, 0, 1),
                skillD = SkillV2(C.V_SKILL_D, 1, 26100, 0, 1),
                skillE = SkillV2(C.V_SKILL_E, 1, 90000, 0, 0),
                skillF800 = SkillV2(C.V_SKILL_F_800, 1, 32000, 0, 0),
                skillF800b = SkillV2(C.V_SKILL_F_800_B, 1, 32000, 0, 0),
            )
        }

        val fast: GABPanelPlanV2
            get() {
                return GABPanelPlanV2(
                    atk = SkillV2(C.V_ATK, 1, 0, 0, 0), // 点击还是75ms正常. 之前这里长期150
                    skillA = SkillV2(C.V_SKILL_A, 1, 12100, 0, 0),
                    skillB = SkillV2(C.V_SKILL_B, 1, 12100, 0, 0),
                    skillC = SkillV2(C.V_SKILL_C, 1, 12100, 0, 0),
                    skillD = SkillV2(C.V_SKILL_D, 1, 12100, 0, 0),
                    skillE = SkillV2(C.V_SKILL_E, 1, 90000, 0, 0),
                    skillF800 = SkillV2(C.V_SKILL_F_800, 1, 32000, 0, 0),
                    skillF800b = SkillV2(C.V_SKILL_F_800_B, 1, 32000, 0, 0),
                )
            }


    }
}